import 'package:flutter/cupertino.dart';

import '../../model/app_config_model.dart';

class AppConfig extends ChangeNotifier {
  late AppConfigModel appConfigModel;

  AppConfig() {
    appConfigModel = AppConfigModel.fromJson({
      "countryCode": "MX",
      "countryName": "Mexico",
      "areaCode": "+52",
      "phonePrefix": "",
      "phoneLength": 10,
      "channelId": "SmartLoan",
      // "baseUrl": "http://testmexico-smartloan-3003.gccloud.xyz/#/user/nation",
      "baseUrl": "http://testmexico-smartloan-3003.gccloud.xyz/#/user/nation",
      "extraMeta": {
        "advanceAccessKey": "54e03a28ec301bb8",
        "advanceSecretKey": "36181f76c174e848",
        "afId": "yFbZbrMQ7eoqbZ4BdAPN",
        "advanceFace": "mex",
        "advanceCardType": "CURP"
      }
    });
  }

  setModel(Map json) async {
    try {
      appConfigModel = AppConfigModel.fromJson(json);
      notifyListeners();

      debugPrint('update appConfigModel: ${appConfigModel.toJson()}');

    } on Exception catch (e) {
      // AppHttpBaseConfig().exceptionHandle(e);
    }

  }

  AppConfigModel getAppConfig() {
    return appConfigModel;
  }

}